<extend name="Public/base" />
<block name="body">
<div class="Tool_Bar" id="Model_Bar">
<dl>
	<dt>模型管理</dt>
	{$Main_Nav}
</dl>
</div>
<form id="Model_Form" class="easyui-tabs Updata_Form" data-options="fit:true,tools:'#Model_Bar',toolPosition:'left',tabHeight:40,border:false" action="{:U('Model/add')}" method="post">
<div title="基础设置" style="padding:20px;">
	<fieldset class="Form_1">
		<div class="formitm">
			<label class="lab"  for="for_name">模型标识：</label>
			<div class="ipt">
				<input name="name" style="height:30px;" id="for_name"  value="{$_info.name}"  type="text" class="easyui-textbox" data-options="required:true">
				<p style="color:#f00">注意首字母大写，具体规则参考ThinkPHP命名规则</p>
			</div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_title">模型名称：</label>
			<div class="ipt">
				<input name="title" style="height:30px;" id="for_title"  value="{$_info.title}" type="text" class="easyui-textbox" data-options="required:true">
				<p>请输入模型的名称</p>
			</div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_table_name">数据表名：</label>
			<div class="ipt">
				<input name="table_name" style="height:30px;" id="for_table_name"  value="{$_info.table_name}" type="text" class="easyui-textbox" data-options="required:true">
				<p>模型的真实表名，唯一且符合数据库命名规则</p>
			</div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_engine_type">引擎类型：</label>
			<div class="ipt">
				<select style="height:30px;" id="for_engine_type" name="engine_type"  value="{$_info.engine_type}" class="easyui-combobox">
					<option value="MyISAM">MyISAM</option>
					<option value="InnoDB">InnoDB</option>
	                <option value="MEMORY">MEMORY</option>
	                <option value="BLACKHOLE">BLACKHOLE</option>
	                <option value="MRG_MYISAM">MRG_MYISAM</option>
	                <option value="ARCHIVE">ARCHIVE</option>
				</select>
				<p>数据表存储的引擎</p>
			</div>
		</div>
      <div class="formitm">
        <label class="lab"  for="for_is_extend">允许子模型：</label>
        <div class="ipt">
          <select style="height:30px;" id="for_is_extend" name="is_extend" class="easyui-combobox" data-options="value:'{$_info['is_extend']}',multiple:false,required:false,editable:false">
            <option value="1" >是</option>
            <option value="0" >否</option>
          </select>
          <p style="color:#F00">如果模型非独立模型，选允许子模型,系统将会出错；本项一旦选择无法更改</p>
        </div>
      </div>
      <div class="formitm">
        <label class="lab"  for="for_extend">模型类型：</label>
        <div class="ipt">
          <select style="height:30px;" id="for_extend" name="extend" class="easyui-combobox" data-options="value:'{$_info['extend']}',multiple:false,required:false,editable:false">
            <option value="0">独立模型</option>
            <volist name="is_extend_list" id='vo'>
              <option value="{$vo['id']}">{$vo['title']} [{$vo['name']}] 子模型</option>
            </volist>
          </select>
          <p style="color:#F00">如果模型非独立模型，选允许子模型,系统将会出错；本项一旦选择无法更改</p>
        </div>
      </div>
		<div class="formitm">
            <label class="lab"  for="for_model_build">模型生成：</label>
            <div class="ipt">
              <select style="height:30px;"id="for_model_build" name="model_build" class="easyui-combobox" data-options="value:'{$_info.model_build}',multiple:false,required:false,editable:false">
                <option value="0" >静态</option>
                <option value="1" >动态</option>
              </select>
              <p>生成文件时是动态还是静态，注：动态需要消耗更多服务器资源。</p>
            </div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_list_type">列表类型：</label>
			<div class="ipt">
	            <select style="height:30px;" id="for_list_type" name="list_type" class="easyui-combobox" data-options="value:'{$_info.list_type}',multiple:false,required:false,editable:false">
	                <option value="0" >普通</option>
	        		<option value="1" >树形</option>
				</select>
				<p>列表页面的显示形态</p>
			</div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_list_edit">行编辑：</label>
			<div class="ipt">
	            <select style="height:30px;" id="for_list_edit" name="list_edit" class="easyui-combobox" data-options="value:'{$_info.list_edit}',multiple:false,required:false,editable:false">
	                <option value="0" >禁用</option>
	        		<option value="1" >启用</option>
				</select>
				<p>在列表页，双击行继续编辑</p>
			</div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_status">状态：</label>
			<div class="ipt">
				<select style="height:30px;" id="for_status" name="status" class="easyui-combobox" data-options="value:'{$_info.status}',multiple:false,required:false,editable:false">
	                <option value="0" >禁用</option>
	                <option value="1" >启用</option>
				</select>
				<p>当前模型状态，当为禁用时有些功能无法使用</p>
			</div>
		</div>
		<div class="formitm">
			<label class="lab"  for="for_field_group">字段分组：</label>
			<div class="ipt">
				<textarea id="for_field_group" name="field_group" class="easyui-textbox" style="width:300px;height:200px;" data-options="required:false,multiline:true">{$_info.field_group}</textarea>
				<p>示例：
				<br/>1:基础
				<br/>2:扩展</p>
			</div>
		</div>
		<div class="formitm formitm-1"><a class="easyui-linkbutton" href="JavaScript:void(0);" onclick="code_edit();Sub_Form('#Model_Form');" data-options="iconCls:'iconfont icon-edit'"><span style="font-size: 14px; font-weight: 600;">提交</span></a></div>
		<input name="id" type="hidden" value="{:I('get.id')}" />
	</fieldset>
</div>
<div title="生成代码扩展" style="padding:20px;">
	<fieldset class="Form_1">
      <div class="formitm">
        <label class="lab"  for="action_extend">控制器扩展：</label>
        <div class="ipt">
          <textarea id="action_extend" name="action_extend">{$_info.action_extend}</textarea>
        </div>
      </div>
      <div class="formitm">
        <label class="lab"  for="model_extend">模型扩展代码：</label>
        <div class="ipt">
          <textarea id="model_extend" name="model_extend">{$_info.model_extend}</textarea>
        </div>
      </div>
      <div class="formitm">
        <label class="lab"  for="index_extend">列表扩展代码：</label>
        <div class="ipt">
          <textarea id="index_extend" name="index_extend">{$_info.index_extend}</textarea>
        </div>
      </div>
      <div class="formitm">
        <label class="lab"  for="add_extend">新增扩展代码：</label>
        <div class="ipt">
          <textarea id="add_extend" name="add_extend">{$_info.add_extend}</textarea>
        </div>
      </div>
      <div class="formitm">
        <label class="lab"  for="edit_extend">编辑扩展代码：</label>
        <div class="ipt">
          <textarea id="edit_extend" name="edit_extend">{$_info.edit_extend}</textarea>
        </div>
      </div>
      <div class="formitm formitm-1"><a class="easyui-linkbutton" href="JavaScript:void(0);" onclick="code_edit();Sub_Form('#Model_Form');" data-options="iconCls:'iconfont icon-edit'"><span style="font-size: 14px; font-weight: 600;">提交</span></a></div>
	</fieldset>
</div>
</form>
<script src="__STATIC__/codemirror/lib/codemirror.js"></script>
<script src="__STATIC__/codemirror/mode/xml/xml.js"></script>
<link rel="stylesheet" href="__STATIC__/codemirror/lib/codemirror.css">
<script>
var action_extend_Editor = CodeMirror.fromTextArea(document.getElementById('action_extend'), {
    mode: "xml",
	lineNumbers: true
});
var model_extend_Editor = CodeMirror.fromTextArea(document.getElementById('model_extend'), {
    mode: "xml",
	lineNumbers: true
});
var index_extend_Editor = CodeMirror.fromTextArea(document.getElementById('index_extend'), {
    mode: "xml",
	lineNumbers: true
});
var add_extend_Editor = CodeMirror.fromTextArea(document.getElementById('add_extend'), {
    mode: "xml",
	lineNumbers: true
});
var edit_extend_Editor = CodeMirror.fromTextArea(document.getElementById('edit_extend'), {
    mode: "xml",
	lineNumbers: true
});
function code_edit(){
	$('#action_extend').val(action_extend_Editor.getValue());
	$('#model_extend').val(model_extend_Editor.getValue());
	$('#index_extend').val(index_extend_Editor.getValue());
	$('#add_extend').val(add_extend_Editor.getValue());
	$('#edit_extend').val(edit_extend_Editor.getValue());
}
</script>
</block>

